<template>
  <!--  学生界面-->
  <el-container class="home_container">
    <el-header class="home_header" style="background-color: #67C23A;">
      <div class="home_title">学生公寓管理系统-学生</div>
      <div class="home_userinfoContainer">
        <el-dropdown>
                  <span class="el-dropdown-link home_userinfo">
                    {{ student.name }}<i class="el-icon-arrow-down el-icon--right home_userinfo"></i>
                  </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </el-header>
    <el-container>

      <el-aside class="home_aside" width="200px">

        <el-menu router>
          <el-menu-item index="/studentHome">
            <i class="el-icon-s-home"></i>
            <span slot="title">首页</span>
          </el-menu-item>

          <el-menu-item index="/studentPersonalInformation">
            <i class="el-icon-user"></i>
            <span slot="title">个人信息管理</span>
          </el-menu-item>

          <el-submenu index="leaveSubMenu">
            <template slot="title">
              <i class="el-icon-tickets"></i>
              <span>请假模块</span>
            </template>
            <el-menu-item index="/studentLeave">
              <i class="el-icon-s-order"></i>
              <span slot="title">学生请假</span>
            </el-menu-item>
            <el-menu-item index="/leaveDetails">
              <i class="el-icon-chat-line-square"></i>
              <span slot="title">请假详情</span>
            </el-menu-item>
          </el-submenu>

          <el-submenu index="maintenanceSubMenu">
            <template slot="title">
              <i class="el-icon-s-tools"></i>
              <span>维修模块</span>
            </template>
            <el-menu-item index="/maintenanceApplication">
              <i class="el-icon-s-order"></i>
              <span slot="title">维修申请</span>
            </el-menu-item>
            <el-menu-item index="/maintenanceDetails">
              <i class="el-icon-chat-line-square"></i>
              <span slot="title">维修详情</span>
            </el-menu-item>
          </el-submenu>

          <el-submenu index="utilitySubMenu">
            <template slot="title">
              <i class="el-icon-water-cup"></i>
              <span>水电费模块</span>
            </template>
            <el-menu-item index="/utilityBill">
              <i class="el-icon-chat-line-square"></i>
              <span slot="title">水电费查看</span>
            </el-menu-item>
          </el-submenu>

          <el-menu-item index="/about3">
            <i class="el-icon-info"></i>
            <span slot="title">关于</span>
          </el-menu-item>
        </el-menu>


      </el-aside>

      <el-container>
        <el-main>
          <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/studentHome' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item v-text="this.$router.currentRoute.name"></el-breadcrumb-item>
          </el-breadcrumb>
          <router-view></router-view>
        </el-main>
        <el-footer class="home_footer">2024 © 学生公寓管理系统</el-footer>
      </el-container>

    </el-container>

  </el-container>
</template>
<script>
export default {
  methods: {
    logout() {
      let _this = this;
      this.$confirm('注销登录吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        localStorage.removeItem('access-student')
        _this.$router.replace({path: '/login'})
      })
    }
  },
  data() {
    return {
      student: ''
    }
  },
  created() {
    let student = JSON.parse(window.localStorage.getItem('student'))
    this.student = student
    this.$store.state.student = student
  },

}
</script>
<style>

</style>
